Skip to content

feat(sync): sync v2 — offline env/labels/observability/deploy-lag checks (closes #141) - #191

Merged
robercano-ghbot merged 3 commits into
mainfrom
feat/issue-141-sync-v2-checks
Jul 24, 2026
Merged

feat(sync): sync v2 — offline env/labels/observability/deploy-lag checks (closes #141)#191
robercano-ghbot merged 3 commits into
mainfrom
feat/issue-141-sync-v2-checks

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

Closes #141

Extends /orchestrator:sync into "sync v2" — the sanctioned migration command — by adding four new offline, detect-and-report check functions to sync.sh, in the same defensive style as the existing detect_stale_vendor_copies. sync.sh stays fully offline/non-interactive/bare-runnable; anything needing the network is emitted as an advisory command and documented as an agent step in SKILL.md (live execution via bot-gh.sh).

Added in this PR

Already covered by prior #134 work (verified, NOT rewritten)

"Do" items 1 & 5's core: managed-file re-stamp ladder, detect_stale_vendor_copies, and the systemd-restart migration caveat were already implemented. This PR only added the genuinely-missing loop-runs.log inspection on top.

Out of scope (deliberately)

Verification

GATES_FILE=.claude/self/gates.json bash .claude/self/checks.sh test → PASS (all 87 checks passed, test: harness smoke OK). build + lint gates green. Both review lenses (correctness, tests; consensus=all) APPROVE.

🤖 Generated with Claude Code

robercano and others added 2 commits July 24, 2026 16:08
… observability (issue #141)

Extends sync.sh with four report-only, offline, self-hosting-safe checks that
close the genuine gaps in issue #141 left after #134's decision (stop
vendoring, detect stale copies) was already implemented: (1) reads
.claude/state/loop-runs.log to tell the operator whether a driver looks
active or idle before they re-arm/restart the loop units, (2) verifies
.env/GH_BOT_TOKEN presence (never the value) and the installed plugin
version against the #136 release floor, printing the live bot-identity
advisory for the agent to run via bot-gh.sh, (3) derives expected
module:<name> + needs-human labels from the target's adapter and prints the
exact bot-gh.sh create commands as advisories, and (4) detects whether
worker-tools.jsonl/events.jsonl observability state exists, referencing
issue #137 for the gap without attempting to fix it. Extends
sync-managed-files.test.sh with offline coverage for every new check plus
self-hosting quieting, and documents the paired live steps in SKILL.md.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…bient GATES_FILE (issue #141)

Blocking review findings on the sync v2 offline checks:
- sync.sh's deploy-lag last_ts parse was unguarded under set -euo pipefail — a
  loop-runs.log last line with no ts= token made grep exit 1 and pipefail abort
  the whole script before the "could not parse a ts=" fallback ever ran. Add the
  missing `|| true`, matching the sibling parses in the same function.
- sync-managed-files.test.sh scenarios 12/12b/15 read the target's adapter via
  sync.sh's default $GATES_FILE resolution without pinning it to their own fixture,
  so an ambient GATES_FILE (e.g. the real self-hosted test gate exporting
  GATES_FILE=.claude/self/gates.json before running *.test.sh) leaked in and broke
  4 checks. Pin GATES_FILE explicitly per fixture, same convention as
  gate.test.sh's write_gates_file/run_gate.

Also folds in the non-blocking asks: explicit coverage for an above-floor plugin
version and a malformed/missing version field in the environment check, and
present-but-empty / present-with-activity coverage for events.jsonl (previously
only worker-tools.jsonl was exercised beyond the absent case).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@robercano-ghbot robercano-ghbot added the needs-human Loop escalated: attempt budget exhausted, manual triage required label Jul 24, 2026
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

feat(sync): sync v2 — offline env/labels/observability/deploy-lag checks (closes #141) (not yet reviewed)

@robercano-ghbot robercano-ghbot added needs-human Loop escalated: attempt budget exhausted, manual triage required and removed needs-human Loop escalated: attempt budget exhausted, manual triage required labels Jul 24, 2026
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

feat(sync): sync v2 — offline env/labels/observability/deploy-lag checks (closes #141) (not yet reviewed)

…ger alone (issue #141)

loop-daemon.sh only appends a loop-runs.log line AFTER a driver exits, so the
ledger has zero signal for an in-flight driver -- a stale OR missing OR just-
appended entry is equally consistent with a new driver running right now.
check_deploy_lag's recent/old-ts branching claimed the opposite ("may still be
ACTIVE" / "looks safe to re-arm/restart"), which is exactly backwards. All
three branches now report the ledger state plainly and defer to an
independent liveness check (systemctl --user status) instead of asserting a
verdict the log can't actually support.

Also strengthens the s12 "labels are advisory-only" test from a vacuous
assertion into a real regression guard (stubs bot-gh.sh/gh both via PATH and
via the literal ${CLAUDE_PLUGIN_ROOT}/scripts/bot-gh.sh path the advisory
string itself uses), and adds version_ge differing-length-component coverage.
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

Stall-recovery update: this branch had partial work + an already-open PR with green CI, but no GitHub review yet. Ran both reviewer lenses (correctness, tests; consensus=all) fresh against the diff before publishing further.

correctness caught a real bug: check_deploy_lag() read a recent loop-runs.log entry as "driver may still be ACTIVE" and an old one as "looks idle — safe to restart". That's backwards — loop-daemon.sh only appends a ledger line after a driver exits, so the ledger has zero signal about an in-flight driver; a stale (or missing, or empty) ledger is equally consistent with a new driver running right now. All three branches (not-found / empty / age-based) now report the ledger plainly and defer to an independent check (systemctl --user status 'pr-loop-driver-*') instead of asserting a verdict the log can't support. Took two more review rounds to catch this in the not-found and empty-ledger branches too (same flaw, different branch).

tests caught a vacuous assertion (test 1 -eq 1, always true) standing in for "labels are advisory-only, no network call". Replaced with a real regression guard: stubs bot-gh.sh/gh both via PATH and via the literal ${CLAUDE_PLUGIN_ROOT}/scripts/bot-gh.sh path the advisory string itself uses (a PATH-only stub was proven to miss that exact construction). Also added version_ge differing-length-component coverage.

All 93 offline checks pass; build/lint/test gates green (GATES_FILE=.claude/self/gates.json); both lenses APPROVE on the final diff. Not merging — still waiting on your review.

@robercano-ghbot robercano-ghbot removed the needs-human Loop escalated: attempt budget exhausted, manual triage required label Jul 24, 2026
@robercano-ghbot
robercano-ghbot merged commit 8141238 into main Jul 24, 2026
9 checks passed
@robercano-ghbot
robercano-ghbot deleted the feat/issue-141-sync-v2-checks branch July 24, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants